<template>
<div class=''>
   <input style="display:none;" id="up" type="file" @change="importExcel">
    <label for="up" class="el-button importButton el-button--default">
        <span class="importButton">表格导入</span>
    </label>
</div>
</template>

<script>
/* 引用：https://blog.csdn.net/Tessa_zzl/article/details/89216426 */
import API from '@/api/easyPoiImportDemo'

export default {
  components: {},
  data () {
    return {

    }
  },
  methods: {
    importExcel (e) {
      let formData = new FormData()
      // 把文件信息放入对象中
      let file = e.target.files[0]
      formData.append('file', file)
      API.importExcel(formData).then(res => {

      }).catch(e => {
        this.$message.error(`error:${e.message}`)
      })
    }
  }
}
</script>
<style lang='less' scoped>
</style>
